﻿<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
	</head>
	<script language="javascript">
		function submitAction(actionName){
			document.userForm.action = actionName ;
			document.userForm.submit();
		}
		
		function init(){
			document.getElementById("userName").value = "";
			document.getElementById("email").value = "";
			document.getElementById("telNo").value = "";
			document.getElementById("mobileNo").value = "";
			document.getElementById("sex").value = "";
		}
		
		function select(action,id){
			location.href = "${ctx}/" + action + "?id=" + id;
		}
		
		function doDelete(action,id){
			if(confirm('是否确认删除？')){
				location.href = "${ctx}/" + action + "?id=" + id ;
			}
		}
	</script>
	
	<body>
		<form method="post" action="" name="userForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2"> 
						用户名 
					</td>
					<td width="30%" class="td2">
						<input type="text" name="userName" size="32" value="${userInfo.userName}">
					</td>
					<td width="20%" class="td2">
						电子邮箱
					</td>
					<td width="30%" class="td2">
						<input type="text" name="email" size="32" value="${userInfo.email}">
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2">
						手机号码
					</td>
					<td width="30%" class="td2">
						<input type="text" name="mobileNo" size="32" value="${userInfo.mobileNo}">
					</td>
					<td width="20%" class="td2"> 
						固定电话 
					</td>
					<td width="30%" class="td2">
						<input type="text" name="telNo" size="32" value="${userInfo.telNo}">
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2"> 
						性别 
					</td>
					<td width="30%" class="td2">
						<c:if test="${userInfo.sex == 1}">
							<input type="radio" name="sex" size="15" value="1" checked="true">男
							&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" size="15" value="0">女
						</c:if>
						<c:if test="${userInfo.sex == 0}">
							<input type="radio" name="sex" size="15" value="1">男
							&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" size="15" value="0" checked="true">女
						</c:if>
						<c:if test="${empty userInfo.sex}">
							<input type="radio" name="sex" size="15" value="1">男
							&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" size="15" value="0">女
						</c:if>
					</td>
					<td width="20%" class="td2">
						
					</td>
					<td width="30%" class="td2">
						
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="search" value="查询" onClick="submitAction('userSearch.ac');">
						&nbsp;&nbsp;<input type="button" name="new" value="新增" onClick="submitAction('newUser.ac');">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="10%" class="td1" align="center">
						动作
					</td>
					<td width="15%" class="td1" align="center">
						用户名
					</td>
					<td width="25%" class="td1" align="center">
						电子邮箱
					</td>
					<td width="15%" class="td1" align="center">
						手机号码
					</td>
					<td width="15%" class="td1" align="center">
						固定电话
					</td>
					<td width="10%" class="td1" align="center">
						性别
					</td>
					<td width="10%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="userInfo" items="${userInfoList}">
					<tr>
						<td class="td2" align="center">
							<a href="javascript:select('selectUser.ac','${userInfo.id}');">选择</a>
						</td>
						<td class="td2">
							${userInfo.userName}
						</td>
						<td class="td2">
							${userInfo.email}
						</td>
						<td class="td2">
							${userInfo.mobileNo}
						</td>
						<td class="td2">
							${userInfo.telNo}
						</td>
						<td class="td2" align="center">
							<c:if test="${userInfo.sex == 1}">男</c:if>
							<c:if test="${userInfo.sex == 0}">女</c:if>
						</td>
						<td class="td2" align="center">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deleteUser.ac','${userInfo.id}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
</html>